$(function(){
    var router = require('./../../router');
    var userLayout = [
        {'name': '首页', iconClass: 'home', isShow: false, subList: []},
        {'name': '系统', iconClass: 'jichu', isShow: false, subList: [
            {'name': '系统参数', iconClass: 'jichu', path: '/usermanagement', subList:[]},
            {'name': '用户管理', iconClass: 'jichu', path: '/usermanagement', subList:[]},
            {'name': '用户日志', iconClass: 'jichu', path: '/usermanagement', subList:[]},
            {'name': '角色权限', iconClass: 'jichu', path: '/rolemanagement', subList:[]}]},
        {'name': '基础', iconClass: 'jichu', isShow: false, subList: [
            {'name': '公司管理', iconClass: 'jichu', path: '/usermanagement', subList:[
                {'name': '组织管理', iconClass: 'jichu', path: '/usermanagement', subList:[]},
                {'name': '员工管理', iconClass: 'jichu', path: '/usermanagement', subList:[]}
                {'name': '职位管理', iconClass: 'jichu', path: '/usermanagement', subList:[]}
            ]},
            {'name': '商品档案', iconClass: 'jichu', path: '/usermanagement', subList:[
                {'name': '商品管理', iconClass: 'jichu', path: '/usermanagement', subList:[]},
                {'name': '商品分类', iconClass: 'jichu', path: '/usermanagement', subList:[]},
                {'name': '商品属性', iconClass: 'jichu', path: '/usermanagement', subList:[]},
                {'name': '商品品牌', iconClass: 'jichu', path: '/usermanagement', subList:[]},
                {'name': '条码规格', iconClass: 'jichu', path: '/usermanagement', subList:[]}
            ]},
            {'name': '供应商管理', iconClass: 'jichu', path: '/usermanagement', subList:[]},
            {'name': '客户管理', iconClass: 'jichu', path: '/usermanagement', subList:[]},
            {'name': '打印配置', iconClass: 'jichu', path: '/usermanagement', subList:[]},
            {'name': '基础配置', iconClass: 'jichu', path: '/usermanagement', subList:[
                {'name': '结算账户', iconClass: 'jichu', path: '/usermanagement', subList:[]},
                {'name': '运输方式', iconClass: 'jichu', path: '/usermanagement', subList:[]},
                {'name': '收支项目', iconClass: 'jichu', path: '/usermanagement', subList:[]}
            ]}]},
        {'name': '采购', iconClass: 'caigou', isShow: false,subList: [
            {'name': '采购订单', iconClass: 'caigou', path: '/purchasepreview',subList:[]},
            {'name': '进货单', iconClass: 'caigou', path: '/usermanagement',subList:[]},
            {'name': '退货单', iconClass: 'caigou', path: '/usermanagement',subList:[]}
        ]},
        {'name': '销售', iconClass: 'xiaoshao', isShow: false,subList: [
            {'name': '销售订单', iconClass: 'xiaoshao', path: '/usermanagement',subList:[]},
            {'name': '销售单', iconClass: 'xiaoshao', path: '/usermanagement',subList:[]},
            {'name': '退货单', iconClass: 'xiaoshao', path: '/usermanagement',subList:[]}
        ]},
        {'name': '财务', iconClass: 'caiwu', isShow: false,subList: [
            {'name': '收款单', iconClass: 'caiwu', path: '/usermanagement',subList:[]},
            {'name': '付款单', iconClass: 'caiwu', path: '/usermanagement',subList:[]},
            {'name': '网络支付', iconClass: 'caiwu', path: '/usermanagement',subList:[]}
        ]},
        {'name': '会员', iconClass: 'yingxiao', isShow: false,subList: [
            {'name': '会员管理', iconClass: 'yingxiao', path: '/usermanagement',subList:[]},
            {'name': '等级管理', iconClass: 'yingxiao', path: '/usermanagement',subList:[]},
            {'name': '积分规则', iconClass: 'yingxiao', path: '/usermanagement',subList:[]},
            {'name': '充值规则', iconClass: 'yingxiao', path: '/usermanagement',subList:[]}
        ]},
        {'name': '营销', iconClass: 'zhisheng', isShow: false,subList: [
            {'name': '优惠券', iconClass: 'zhisheng', path: '/usermanagement',subList:[]},
            {'name': '满减送', iconClass: 'zhisheng', path: '/usermanagement',subList:[]},
            {'name': '短信营销', iconClass: 'zhisheng', path: '/usermanagement',subList:[]}
        ]},
        {'name': '零售', iconClass: 'huiyuan', isShow: false,subList: [
            {'name': '门店管理', iconClass: 'huiyuan', path: '/usermanagement',subList:[]},
            {'name': '收银员管理', iconClass: 'huiyuan', path: '/usermanagement',subList:[]},
            {'name': '零售指标', iconClass: 'huiyuan', path: '/usermanagement',subList:[]}
        ]},
        {'name': '收银', iconClass: 'canmou', isShow: false,subList: [
            {'name': '普通收银', iconClass: '', path: '/usermanagement',subList:[]},
            {'name': '商品收银', iconClass: '', path: '/usermanagement',subList:[]},
            {'name': '会员充值', iconClass: '', path: '/usermanagement',subList:[]},
            {'name': '退货退款', iconClass: '', path: '/usermanagement',subList:[]},
            {'name': '收银订单', iconClass: '', path: '/usermanagement',subList:[]}
        ]},
        {'name': '微信', iconClass: 'weixin', isShow: false,subList: [
            {'name': '微信用户', iconClass: '', path: '/usermanagement',subList:[]},
            {'name': '微信菜单', iconClass: '', path: '/usermanagement',subList:[]},
            {'name': '微信消息', iconClass: '', path: '/usermanagement',subList:[]},
            {'name': '微信商城', iconClass: '', path: '/usermanagement',subList:[]},
            {'name': '微信爆问', iconClass: '', path: '/usermanagement',subList:[]}
        ]},
        {'name': '报表', iconClass: 'ipos', isShow: false,subList: [
            {name: '采购报表', iconClass: '', path: '/usermanagement',subList:[]}
            {name: '销售报表', iconClass: '', path: '/usermanagement',subList:[]},
            {name: '库存报表', iconClass: '', path: '/usermanagement',subList:[]},
            {name: '财务报表', iconClass: '', path: '/usermanagement',subList:[]},
            {name: '会员报表', iconClass: '', path: '/usermanagement',subList:[]},
            {name: '营销报表', iconClass: '', path: '/usermanagement',subList:[]},
            {name: '零售报表', iconClass: '', path: '/usermanagement',subList:[]},
            {name: '集团报表', iconClass: '', path: '/usermanagement',subList:[]}
        ]},{'name': '智胜', iconClass: 'ipos', isShow: false,subList: [
            {name: '供应链分析', iconClass: 'IPOS', path: '/usermanagement',subList:[]},
            {name: '商品结构分析', iconClass: 'IPOS', path: '/usermanagement',subList:[]},
            {name: '会员分析', iconClass: 'IPOS', path: '/usermanagement',subList:[]},
            {name: '零售分析', iconClass: 'IPOS', path: '/usermanagement',subList:[]}
        ]}
    ];
    /*
     * 组件
     *
     * */
    var User = new Vue({
        el: '#J-zsls',
        router: router,
        data: {
            userLayout: userLayout
        },
        methods:{
            triggerItem: function(index){

                var index = index.index;

                if(!this.userLayout[index].subList.length) return;

                if(this.userLayout[index]['isShow'])
                    this.userLayout[index]['isShow'] = false;
                else
                    this.userLayout[index]['isShow'] = true;
            }
        },
        components: {}
    });

    /*
    *
    * 滚动
    *
    * */
    $('#J-layoutLeft').niceScroll(
        {
            cursorcolor:"#989494",
            cursoropacitymax:1,
            touchbehavior:false,
            cursorwidth:"3px",
            cursorborder:"0",
            cursorborderradius:"5px"
        });
    $('#J-tableScroll').niceScroll(
        {
            cursorcolor:"#989494",
            cursoropacitymax:1,
            touchbehavior:false,
            cursorwidth:"3px",
            cursorborder:"0",
            cursorborderradius:"5px"
        });
})
